﻿package mortal.game.resource
{
    import com.gengine.resource.*;
    import flash.utils.*;
    import mortal.game.resource.info.*;

    public class ModelAttackFrameConfig extends Object
    {
        private var _map:Dictionary;
        private static var _instance:ModelAttackFrameConfig;

        public function ModelAttackFrameConfig()
        {
            this._map = new Dictionary();
            if (_instance != null)
            {
                throw new Error(" ResConfig 单例 ");
            }
            this.init();
            return;
        }// end function

        private function write(param1:Object) : void
        {
            var _loc_2:ModelAttackFrameInfo = null;
            var _loc_3:Object = null;
            var _loc_4:Object = null;
            for each (_loc_3 in param1.fireFrames)
            {
                
                for each (_loc_4 in _loc_3)
                {
                    
                    _loc_2 = new ModelAttackFrameInfo();
                    _loc_2.career = _loc_4.career;
                    _loc_2.sex = _loc_4.sex;
                    _loc_2.action = _loc_4.action;
                    _loc_2.fireFrame = _loc_4.fireFrame;
                    if (_loc_4.hasOwnProperty("handsEndFrame"))
                    {
                        _loc_2.handsEndFrame = _loc_4.handsEndFrame;
                    }
                    if (_loc_4.hasOwnProperty("attackEndFrame"))
                    {
                        _loc_2.attackEndFrame = _loc_4.attackEndFrame;
                    }
                    if (_loc_4.hasOwnProperty("waitEndFrame"))
                    {
                        _loc_2.waitEndFrame = _loc_4.waitEndFrame;
                    }
                    this._map[_loc_2.career + "" + _loc_2.sex + _loc_2.action] = _loc_2;
                }
            }
            return;
        }// end function

        public function init() : void
        {
            var _loc_1:* = ConfigManager.instance.getObjectByFileName("modelAttackFrame.xml");
            this.write(_loc_1);
            return;
        }// end function

        public function getAttackFrameInfo(param1:int, param2:int, param3:String) : ModelAttackFrameInfo
        {
            return this._map[param1 + "" + param2 + param3];
        }// end function

        public static function get instance() : ModelAttackFrameConfig
        {
            if (_instance == null)
            {
                _instance = new ModelAttackFrameConfig;
            }
            return _instance;
        }// end function

    }
}
